#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
using namespace std;
#include "utils/to_ostream.h"
#include "component/config.h"
using namespace tdl;

//////////////////////
int main(int argc, char* argv[])
{
	string s = "\
		<main>\n\
			local_ip = 192.168.1.9\n\
			<udp_recv_port>\n\
				1 = 25210\n\
				2 = 25211\n\
			</udp_recv_port>\n\
			<tcp_recv_port>\n\
				1 = 9527\n\
				2 = 9528\n\
			</tcp_recv_port>\n\
		</main>";
	
	tdl::stream_config conf;
	try {
		conf.initialize(s);

		cout << conf["main\\local_ip"] << endl;

		map<string, string> udp_ports = conf.get_pairs("main\\udp_recv_port");
		cout << "get_pairs: " << endl << udp_ports << endl;

		vector<string> foo = conf.get_domains("main");
		cout << "get_domains: " << foo << endl;

		foo = conf.get_subpath("main");
		cout << "get_subpath: " << foo << endl;
	} catch(conf_ex& e) {
		cerr << e.what_hell() << endl;
		return 1;
	}

	return 0;
}

